<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
    <el-form-item label="开户人" prop="fullName">
      <el-input style="width: 160px" v-model="queryParams.fullName" placeholder="开户人" clearable @keyup.enter.native="handleQuery" />
    </el-form-item>
    <el-form-item label="银行卡号" prop="collectionAccountNo">
      <el-input style="width: 200px" v-model="queryParams.collectionAccountNo" placeholder="银行卡号" clearable @keyup.enter.native="handleQuery" />
    </el-form-item>
    <el-form-item label="手机号" prop="collectionAccountPhone">
      <el-input style="width: 160px" v-model="queryParams.collectionAccountPhone" placeholder="银行卡预留手机号" clearable @keyup.enter.native="handleQuery" />
    </el-form-item>
      <el-form-item label="提现时间" prop="dateRange">
        <el-date-picker
          style="max-width: 240px"
          v-model="dateRange"
          type="daterange"
          size="small"
          align="right"
          unlink-panels
          value-format="yyyy-MM-dd"
          format="yyyy-MM-dd"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item label="审核状态" prop="state">
        <el-select style="width: 160px" v-model="queryParams.state" placeholder="审核状态" clearable >
          <el-option v-for="dict in dict.type.store_state_apply" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" />
    </el-row>

    <el-table v-loading="loading" :data="withdrawalList">
      <el-table-column label="ID" align="center" prop="id" />
      <el-table-column label="开户人" align="center" prop="fullName" />
      <el-table-column label="身份证号" align="center" prop="collectionIdCardNo" />
      <el-table-column label="银行预留手机号" align="center" prop="collectionAccountPhone" width="170" />
      <el-table-column label="银行名称" align="center" prop="collectionAccountName" />
      <el-table-column label="银行卡号" align="center" prop="collectionAccountNo" />
      <el-table-column label="开户行地址" align="center" prop="addressText" />
      <el-table-column label="提现金额" align="center" prop="amount" />
      <el-table-column label="手续费" align="center" prop="amountService" />
      <el-table-column label="到账金额" align="center" prop="amountReal" />
      <el-table-column label="提现时间" align="center" prop="createTime" width="100" />
      <el-table-column label="审核状态" align="center" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.store_state_apply" :value="scope.row.state" />
        </template>
      </el-table-column>
      <el-table-column label="审核备注" align="center" prop="rejectRemark" />
      <el-table-column label="审核时间" align="center" prop="applyTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.applyTime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNo"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  </div>
</template>

<script>
import { withdrawalPage } from "@/api/asset/asset";
export default {
  name: "Store",
  dicts: ["store_state_apply"],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 店铺表格数据
      withdrawalList: [],
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        fullName:"",
        collectionAccountNo:"",
        state:"",
        collectionAccountPhone: "",
        beginCreateTime:"",
        endCreateTime:""
      },
      // 日期范围
      dateRange: [],
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询店铺列表 */
    getList() {
      this.loading = true;
      if(!Array.isArray(this.dateRange)){
        this.dateRange=[]
      }
      this.queryParams.beginCreateTime=this.dateRange[0]
      this.queryParams.endCreateTime=this.dateRange[1]
      withdrawalPage(this.queryParams).then((response) => {
        this.withdrawalList = response.data.records;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },}
};
</script>
<style lang="scss" scoped></style>
